package hui.zhang.service.base.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import hui.zhang.dao.base.AreaRepository;
import hui.zhang.domain.base.Area;
import hui.zhang.service.base.AreaService;

@Service
@Transactional
public class AreaServiceImpl implements AreaService {

	@Autowired
	private AreaRepository areaRepository;
	
	@Override
	public void save(List<Area> list) {
		areaRepository.save(list);
	}
	
	public Page<Area> findAll(Specification<Area> specification, Pageable pageable) {
		Page<Area> page = areaRepository.findAll(specification, pageable);
		return page;
	}

	@Override
	public List<Area> findAll() {
		List<Area> list = areaRepository.findAll();
		return list;
	}

	@Override
	public List<String> queryProvince() {
		return areaRepository.queryProvince();
	}

	@Override
	public List<String> queryCity(String province) {
		return areaRepository.queryCity(province);
	}

	@Override
	public List<Area> queryDistrict(String city) {
		return areaRepository.queryDistrict(city);
	}

	@Override
	public List<Area> findByProvince(String province) {
		return areaRepository.findByProvince(province);
	}



}
